package com.drojian.thread;

public class SellTicket extends Thread {
    static int ticket = 1;
    @Override
    public void run() {
        while (true) {
            synchronized (SellTicket.class) {
                if (ticket <= 100) {
                    System.out.println(Thread.currentThread().getName() + "卖票，票号为：" + ticket);
                    ticket++;
                } else {
                    break;
                }
            }
        }
    }
}
